// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property(cc.Button)
    btnStart: cc.Button = null;

    @property(cc.Button)
    btnJump: cc.Button = null;

    @property(cc.Node)
    inputWindow: cc.Node = null;

    @property(cc.Node)
    mask: cc.Node = null;

    @property(cc.EditBox)
    inputName: cc.EditBox = null;

    // LIFE-CYCLE CALLBACKS:

    touchBtn(event:cc.Event.EventTouch){
        console.log('touch 开始测试')
        this.inputWindow.active = true;
        this.mask.active = true;
    }

    jumpBtn(event:cc.Event.EventTouch){
        console.log('jump 跳转页面')
        let a = window["Win_Global"];
        a.update(0,this.inputName.string);
        cc.director.loadScene('nameMake')
    }

    onLoad () {
        this.mask.active = false;
        this.inputWindow.active = false;
        this.btnStart.node.on(cc.Node.EventType.TOUCH_END, this.touchBtn, this)
        this.btnJump.node.on(cc.Node.EventType.TOUCH_END, this.jumpBtn,this)
    }

    start () {}

    update (dt) {}
}
